#include <cstdio>
#define mod 998244353

typedef long long ll;
const int N = 2010;

ll n, k, ans, inv;
ll x[N], y[N];

ll pow(ll base, ll index) {
	ll res = 1;
	while (index) {
		if (index & 1) res = base * res % mod;
		base = base * base % mod;
		index >>= 1;
	}
	return res;
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
	freopen("testdata.in", "r", stdin);
	freopen("testdata.out", "w", stdout);
#endif
#ifndef LOCAL
	freopen("Largrange.in", "r", stdin);
	freopen("Largrange.out", "w", stdout);
#endif
#endif
	scanf("%lld%lld", &n, &k);
	for (int i = 1; i <= n; ++i) {
		scanf("%lld%lld", &x[i], &y[i]);
	}
	for (int i = 1; i <= n; ++i) {
		for (int j = 1; j <= n; ++j) {
			if (i != j) {
				y[i] = y[i] * (k - x[j] + mod) % mod;
			}
		}
		for (int j = 1; j <= n; ++j) {
			if (i != j) {
				inv = pow(x[i] - x[j] + mod, mod - 2);
				y[i] = y[i] * inv % mod;
			}
		}
		ans = (ans + y[i]) % mod;
	}
	printf("%lld", ans);
	return 0;
}